import http  from "@/api/http.js";

export function getCourses(){
  return http.get('/list-courses')
}
export function addCourses(data){
  return http.post('/add-courses', data);
}
export function deletePost(id) {
  return http.delete('/delete-courses/' + id);
}
export function updatePost(id, data) {
  return http.put(`/update-courses/${id}`, data)
}
export function getAllChapters(){
  return http.get(`/list-chapters`)
}

export function getChapters(courseId){
  return http.get(`/list-chapters/${courseId}`)
}

export function addChapters(data){
  return http.post('/add-chapters', data);
}
export function deleteChapters(id){
  return http.delete(`/delete-chapters/${id}`);
}
export function updateChapters(id, data) {
  return http.put(`/update-chapters/${id}`, data)
}
export function getAllSections(){
  return http.get(`/list-sections`)
}

export function getSections(chapterId){
  return http.get(`/list-sections/${chapterId}`)
}

export function addSections(data){
  return http.post('/add-sections', data);
}
export function deleteSections(id){
  return http.delete(`/delete-sections/${id}`);
}
export function getVideoResources(sectionId){
  return http.get(`/list-video_resources/${sectionId}`)
}

export function addVideoResources(data){
  return http.post('/add-video_resources', data)
}

export function getVideoAttachments(sectionId){
  return http.get(`/list-video_attachments/${sectionId}`)
}

export function addVideoAttachments(data){
  return http.post('/add-video_attachments', data)
}

export function getTextContents(sectionId){
  return http.get(`/list-text_contents/${sectionId}`)
}

export function addTextContents(data){
  return http.post('/add-text_contents', data)
}

export function getTextImages(sectionId){
  return http.get(`/list-text_images/${sectionId}`)
}

export function addTextImages(data){
  return http.post('/add-text_images', data)
}
